package ls.jpa.chapterC.domain;

import ls.jpa.chapterC.base.AudiTableEntity;
import org.apache.commons.lang.builder.ToStringBuilder;

import javax.persistence.*;
import java.util.Collection;

/**
 * @author Barudisshu
 */
@Entity
@Table(name = "t_address", schema = "", catalog = "db_test")
@AttributeOverride(name = "id", column = @Column(name = "address_id", length = 32))
public class Address extends AudiTableEntity {

    @Basic
    @Column(name = "address_name")
    private String addressName;
    @Basic
    @Column(name = "address_type")
    private String addressType;
    @OneToMany(mappedBy = "address")
    private Collection<Customer> customers;

    public String getAddressName() {
        return addressName;
    }

    public void setAddressName(String addressName) {
        this.addressName = addressName;
    }

    public String getAddressType() {
        return addressType;
    }

    public void setAddressType(String addressType) {
        this.addressType = addressType;
    }

    public Collection<Customer> getCustomers() {
        return customers;
    }

    public void setCustomers(Collection<Customer> customers) {
        this.customers = customers;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}
